﻿<Page x:Class="WpfViewBox.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1" Height="314" Width="771">
    <DockPanel>
        <Canvas x:Name="tst"/>
        <StackPanel Margin="0,0,0,10" HorizontalAlignment="Center" Orientation="Horizontal" DockPanel.Dock="Top">
            <Button Name="btn1" Click="stretchNone">Stretch="None"</Button>
            <Button Name="btn2" Click="stretchFill">Stretch="Fill"</Button>
            <Button Name="btn3" Click="stretchUni">Stretch="Uniform"</Button>
            <Button Name="btn4" Click="stretchUniFill">Stretch="UniformToFill"</Button>
        </StackPanel>

        <StackPanel Margin="0,0,0,10" HorizontalAlignment="Center" Orientation="Horizontal" DockPanel.Dock="Top">
            <Button Name="btn5" Click="sdUpOnly">StretchDirection="UpOnly"</Button>
            <Button Name="btn6" Click="sdDownOnly">StretchDirection="DownOnly"</Button>
            <Button Name="btn7" Click="sdBoth">StretchDirection="Both"</Button>
        </StackPanel>

        <TextBlock DockPanel.Dock="Top" Name="txt1" />
        <TextBlock DockPanel.Dock="Top" Name="txt2" />

        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
            <Viewbox MaxWidth="500" MaxHeight="500" Name="vb1">
                <Image Source="Desert.jpg"/>
            </Viewbox>
        </StackPanel>
    </DockPanel>
</Page>
